const express = require('express');
const bodyParser = require('body-parser');
const path = require('path');
const homeRouter = require('./routes/home');
const uploadRouter = require('./routes/upload');
const app = express();

app.use(bodyParser.urlencoded({
  extended: false
}))
app.use(bodyParser.json())
// 静态资源中间件
app.use('/static', express.static(path.join(__dirname, 'public')));
// 使用模板引擎
// 告诉app 视图 模板文件 放置的目录
app.set('views', path.join(__dirname, 'views'));
// 告诉app使用哪个模板引擎
app.set('view engine', 'ejs');



app.use(homeRouter);
app.use(uploadRouter);
app.listen(3000, () => {
  console.log('start at port 3000');
})